package com.hitales.liteflow.liteflowdemo.declarative;

import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum;

@LiteflowComponent("AdeCmp")
public class AdeCmp{

    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeType = NodeTypeEnum.COMMON)
    public void processAcmp(NodeComponent bindCmp) {
        System.out.println("ACmp executed!");
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeType = NodeTypeEnum.COMMON)
    public boolean isAcmpAccess(NodeComponent bindCmp){
        return true;
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.BEFORE_PROCESS, nodeType = NodeTypeEnum.COMMON)
    public void beforeAcmp(NodeComponent bindCmp){
        System.out.println("before A");
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.AFTER_PROCESS, nodeType = NodeTypeEnum.COMMON)
    public void afterAcmp(NodeComponent bindCmp){
        System.out.println("after A");
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.ON_SUCCESS, nodeType = NodeTypeEnum.COMMON)
    public void onAcmpSuccess(NodeComponent bindCmp){
        System.out.println("Acmp success");
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.ON_ERROR, nodeType = NodeTypeEnum.COMMON)
    public void onAcmpError(NodeComponent bindCmp, Exception e){
        System.out.println("Acmp error");
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.IS_END, nodeType = NodeTypeEnum.COMMON)
    public boolean isAcmpEnd(NodeComponent bindCmp) {
        return false;
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.ROLLBACK, nodeType = NodeTypeEnum.COMMON)
    public void rollbackA(NodeComponent bindCmp) throws Exception {
        System.out.println("ACmp rollback!");
    }
}

